/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managed.util;

import domen.User;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.FacesContext;
import javax.jms.JMSException;
import javax.jms.Session;
import javax.servlet.http.HttpServletRequest;

/**
 *
 * @author Danilo
 */
public class LogInOutManager {

    public static void login(User user) {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("id", user.getUsername());

    }

    public static void logout(String username) {
        HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
        request.getSession().invalidate();
    }
}
